import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../../utils/configs/color_config.dart';
import '../../utils/configs/text_style_config.dart';
import '../../utils/customs/zz_button.dart';

class ConnectedStatusWidget extends StatefulWidget {
  final bool isSuc;
  final String connectStatusValue;
  const ConnectedStatusWidget(
      {super.key, required this.isSuc, this.connectStatusValue = ""});

  @override
  State<ConnectedStatusWidget> createState() => _ConnectedStatusWidgetState();
}

class _ConnectedStatusWidgetState extends State<ConnectedStatusWidget> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("Result")),
      body: SafeArea(
        minimum: const EdgeInsets.only(top: 30),
        child: Padding(
          padding: const EdgeInsets.all(20),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              const SizedBox(width: double.infinity),
              widget.isSuc
                  ? Image.asset("assets/images/成功.png")
                  : Image.asset("assets/images/错误 .png"),
              ZZButton(
                height: 44,
                constraints: BoxConstraints(
                  minWidth: 160.w,
                ),
                padding: const EdgeInsets.only(left: 20, right: 20),
                mainAxisAlignment: MainAxisAlignment.center,
                title: Text(widget.connectStatusValue,
                    style: TextStyleConfig.bold.size(16)),
                decoration: BoxDecoration(
                    color: widget.isSuc ? ColorConfig.orange : ColorConfig.gray,
                    borderRadius: const BorderRadius.all(Radius.circular(22))),
                margin: const EdgeInsets.only(top: 40),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
